package com.example.food03.bool;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


import com.example.food03.R;

import java.util.List;

public class WxServiceAdapter extends BaseAdapter {
    private Context context;
    private List<WxService> list;
    public WxServiceAdapter(Context c,List<WxService> list){
        this.context=c;
        this.list=list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View view1;
        if(view!=null){
            view1=view;
        }else {
            view1=View.inflate(context, R.layout.lu,null);
        }
        ImageView imageView=view1.findViewById(R.id.imageView);
        imageView.setImageBitmap(list.get(i).getImgd());
        TextView t1=view1.findViewById(R.id.textView);
        WxService wxService=list.get(i);
        t1.setText(wxService.getString());
        imageView.getImageAlpha();
        return view1;
    }
}
